Skip to content

server: control honouring internal IDs by old APIs#11976

Open
shwstppr wants to merge 3 commits into
apache:mainfrom
shapeblue:controluse-api-internalids
Open

server: control honouring internal IDs by old APIs#11976
shwstppr wants to merge 3 commits into
apache:mainfrom
shapeblue:controluse-api-internalids

Conversation

@shwstppr

@shwstppr shwstppr commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Description

Fixes #9684

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Fixes apache#9684

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@codecov

codecov Bot commented Nov 4, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.47%. Comparing base (bfc4f60) to head (a6fe49e).
⚠️ Report is 729 commits behind head on main.

Files with missing lines Patch % Lines
server/src/main/java/com/cloud/api/ApiServer.java 66.66% 2 Missing ⚠️
...ava/com/cloud/api/dispatch/ParamProcessWorker.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11976      +/-   ##
============================================
+ Coverage     17.56%   19.47%   +1.90%     
- Complexity    15540    19360    +3820     
============================================
  Files          5909     6301     +392     
  Lines        529045   568776   +39731     
  Branches      64615    69669    +5054     
============================================
+ Hits          92933   110751   +17818     
- Misses       425657   445948   +20291     
- Partials      10455    12077    +1622     
Flag Coverage Δ
uitests 3.42% <ø> (-0.17%) ⬇️
unittests 20.74% <57.14%> (+2.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm (as said on the issue, we can expand on it but good as is)

@shwstppr shwstppr marked this pull request as ready for review November 6, 2025 09:11
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16647

@DaanHoogland DaanHoogland added this to the 4.23.0 milestone Jan 30, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

@nvazquez can you check/review?

@DaanHoogland DaanHoogland requested a review from nvazquez January 30, 2026 10:17
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-15345)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55576 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11976-t15345-kvm-ol8.zip
Smoke tests completed. 146 look OK, 4 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_arping_in_ssvm Failure 5.20 test_diagnostics.py
ContextSuite context=TestListIdsParams>:teardown Error 1.14 test_list_ids_parameter.py
test_01_snapshot_root_disk Error 4.84 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 49.63 test_snapshots.py
test_02_list_snapshots_with_removed_data_store Error 49.63 test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:teardown Error 32.50 test_snapshots.py
test_01_snapshot_usage Error 25.76 test_usage.py
test_01_vpn_usage Error 1.09 test_usage.py

Comment thread server/src/main/java/com/cloud/api/ApiServer.java Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 07:04
Comment thread server/src/main/java/com/cloud/api/ApiServer.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a global configuration switch to control whether legacy (pre-3.x) APIs may still accept internal database IDs for UUID-typed parameters, enabling stricter UUID-only enforcement to address issue #9684.

Changes:

  • Introduces a new global config key api.disallow.internal.ids in ApiServer.
  • Applies the config in ParamProcessWorker.translateUuidToInternalId to prevent fallback parsing of numeric/internal IDs when disallowed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java Gates “pre-3.x internal ID fallback” logic on a new global config flag.
server/src/main/java/com/cloud/api/ApiServer.java Adds and registers the api.disallow.internal.ids configuration key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +351 to +361
public static final ConfigKey<Boolean> ApiDisallowInternalIds = new ConfigKey<>(
ConfigKey.CATEGORY_ADVANCED,
Boolean.class,
"api.disallow.internal.ids",
"true",
"When enabled, APIs will not honour requests containing internal database IDs. "
+ "Only UUIDs will be accepted as entity identifiers. "
+ "By default, internal IDs are still accepted for backward compatibility with pre-3.x APIs.",
true,
ConfigKey.Scope.Global
);
Comment on lines 513 to +514
// If annotation's empty, the cmd existed before 3.x try conversion to long
final boolean isPre3x = annotation.since().isEmpty();
final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
final boolean isPre3x = annotation.since().isEmpty();
final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Copilot AI review requested due to automatic review settings July 13, 2026 07:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
final boolean isPre3x = annotation.since().isEmpty();
final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
final boolean isPre3x = annotation.since().isEmpty();
final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Comment on lines +356 to +358
"When enabled, APIs will not honour requests containing internal database IDs. "
+ "Only UUIDs will be accepted as entity identifiers. "
+ "By default, internal IDs are not accepted even for pre-3.x APIs.",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] Internal DB IDs used as parameters

6 participants